feat: start, stop, status Commands#1
Merged
Conversation
Introduces a Database struct for managing time entries using SQLite, including initialization, entry creation, retrieval, stopping, and closing. Adds a TimeEntry model with duration and running status helpers to support time tracking functionality.
Adds a functional 'start' command to begin time tracking for the current project, including checks for existing running sessions and project name detection. Enhances internal/storage/db.go with detailed documentation for the Database type and its methods, clarifying usage and error handling. Updates CLI descriptions for improved clarity and sets the application version.
Added logic to stop the currently running time tracking session, including error handling and duration formatting. The command now interacts with the storage layer to find and stop active sessions, and prints the tracked duration in a human-readable format.
Added logic to the status command to display information about the currently running time tracking session, including project name, start time, duration, and description. Also made minor formatting adjustments in start and stop commands for consistency.
Deleted the internal/commands/root.go file. This may be part of a refactor or cleanup to remove unused or obsolete command logic.
Imported the github.com/mattn/go-sqlite3 package to enable SQLite database support in the storage layer.
Bump CLI version to 0.1.0. Remove unused dependencies from go.mod and go.sum. Improve error message consistency in internal/storage/db.go by using lowercase. Remove license comment from main.go.
start, stop, status Commandsstart, stop, status Commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a significant refactor and implementation of core functionality for the
tmpoCLI time tracker. The changes replace placeholder code with real time tracking logic, add persistent storage using SQLite, and provide user-friendly command-line interactions for starting, stopping, and checking the status of time tracking sessions.The most important changes are:
Core functionality and commands:
start,stop, andstatuscommands, including user feedback, error handling, and automatic project detection based on the current directory. The commands now interact with persistent storage and provide clear output to the user. [1] [2] [3]Persistent storage:
internal/storagepackage with aDatabasewrapper for SQLite, including initialization, schema migration, and CRUD operations for time entries. This enables tracking sessions to persist across runs.TimeEntrymodel with helper methods for duration calculation and running status.User experience improvements:
Dependency and project setup:
go.modto include only the required dependencies for SQLite and Cobra, cleaning up unused indirect dependencies.main.go.